<% 
System.out.println("======== CFHDCMT07============");
//--------------------------------------------------------------------------------->
//
// Copyright 2002 e Professional Corporation.  All Rights Reserved.
//
// File:       	CFHDPCMT06.jsp
//
// Author:   	Noom
//
// Start Date:	20/12/47
//
// Finish Date: XX/XX/XXXX 
//
// Update Date : xx/xx/xxxx by Who
// ............????????..........
//
// Update Date : xx/xx/xxxx by Who
// ............????????..........




//--------------------------------------------------------------------------------->
//errorPage		="../include/eproErrorPage.jsp"
%>

<%//@include file="../include/eproAuthorization.jsp"%>
<%@ page 
	
	contentType	="text/html; charset=windows-874" 
	import				="com.epro.standard.usermenu.UserAccountVO,
									com.epro.standard.frontend.util.FileInfoUtil,
									com.epro.standard.frontend.util.EproServletUtil,
									com.epro.standard.frontend.util.ShowData,
									java.util.Vector,
									java.text.DecimalFormat,
									
		 java.text.SimpleDateFormat,
         java.util.Calendar,
         java.util.GregorianCalendar,
         
         com.softplus.carrefour.hd.CFHDSystem, 
         com.softplus.carrefour.hd.bltier.pc.CCaseHeadManage ,
         com.softplus.carrefour.hd.bltier.pc.ICaseHeadViewer,
         com.softplus.carrefour.hd.bltier.entity.CfhdCaseHead ,
         com.softplus.carrefour.hd.bltier.admin.CFHDSystemManage,
         
         com.softplus.carrefour.hd.bltier.pc.CCaseDetailManage,      
         com.softplus.carrefour.hd.bltier.pc.ICaseDetailViewer,
         com.softplus.carrefour.hd.bltier.entity.CfhdCaseDetail,    
        
        com.softplus.carrefour.hd.bltier.pc.CCaseDocManage,       
         com.softplus.carrefour.hd.bltier.pc.ICaseDocViewer,     
        com.softplus.carrefour.hd.bltier.entity.CfhdCaseDoc,
        
        com.softplus.carrefour.hd.bltier.entity.CfhdCaseDocPK,
        java.math.BigDecimal,          
        
        com.softplus.carrefour.hd.bltier.entity.CfhdCaseDetailPK,
         com.softplus.carrefour.hd.bltier.entity.UserAccount,
         com.softplus.carrefour.hd.bltier.admin.IUserLevelViewer,
         com.softplus.carrefour.hd.bltier.admin.UserLevelManage,
         com.softplus.carrefour.CFException,
         com.softplus.carrefour.hd.bltier.entity.UserLevel" 
									
%>
<%@page import="java.util.HashMap"%>
<HTML xmlns:epro>
<%@ taglib uri="/WEB-INF/HeadTag.tld" prefix="head"%>
<%@ taglib uri="/WEB-INF/ToolbarTag.tld" prefix="toolbar"%>
<%@ taglib uri="/WEB-INF/TextfieldTag.tld" prefix="textfield"%>
<%@ taglib uri="/WEB-INF/TextareaTag.tld" prefix="textarea"%>
<%@ taglib uri="/WEB-INF/ListboxTag.tld" prefix="listbox"%>
<%@ taglib uri="/WEB-INF/ErrorTag.tld" prefix="error"%>
<head:Head 
	author		="Noom"
	title				="Case Detail:Update Case"
	import		="toolbar,textfield,textarea,listbox"
	jsFile			="../script/spTitleRefresh.js,../script/imgProp.js,../script/Alert.js,../script/checkValidData.js,../script/convertDataType.js,../script/dateCalendar.js,../script/historytable.js"

	styleFile	="../theme/defaultTheme.css,../theme/historyTableTheme.css">
     </head:Head>
	<%//@include file="../include/eproFileInfo.jsp" %>
<% 
//	FileInfoUtil fileInfoUtil					= (FileInfoUtil)session.getAttribute("fileInfoUtil");
	FileInfoUtil	fileInfoUtil 			= session.getAttribute("fileInfoUtil")!=null?(FileInfoUtil)session.getAttribute("fileInfoUtil"):new FileInfoUtil() ;

     fileInfoUtil.setMenuIDCode("CFHDPCMT07 ") ;
	fileInfoUtil.setMenuName(" Update Case") ;
	fileInfoUtil.setMenuDesc(" Update Case") ;
		
	ShowData showData 	= new ShowData();
	String checkunload = request.getParameter("checkunload") == null ? "" : request.getParameter("checkunload");		
	
//	String masterWidth 			= com.epro.standard.frontend.datasetup.MessageManager.getMasterDetailWidth();
	String linkParameter 		= "?";
	
   		String tableWidth			= "735";
		String tableWidth1		= "735";
		String labelColWidth	= "150";
        String labelColWidth2	= "150";
		
		String inputColWidth	= "200";
		String inputColWidth1	= "10%";
		
		String longBoxWidth	= "523";
		String buttonWidth		= "70";
 		String longBoxWidthAttachment	= "445";
 		
 		String                          dialogWidth   = "710";
    	String                          dialogHeight = "550";
   

 
 //-=========================================   
 
  UserAccount     userVO          =    (UserAccount)session.getAttribute("userVO");
  
 String userid=userVO.getUserId();
 System.out.println(" =userid===!!!!!!!!!!!!!!!!!!!!!!!!!! "+ userid);

 //=========================================== 
   
   // int vectorSize    =  10; //data vector size.
    Calendar                    gCal                = new GregorianCalendar();
    SimpleDateFormat  sdFormat       = new SimpleDateFormat("dd/MM/yyyy HH:mm");
    //-----------------------------------------------
	String caseID = request.getParameter("caseID") == null ? "" : request.getParameter("caseID");
 	System.out.println(" =caseID==+++++++++++++++"+ caseID);	
 	
  
  //-=========================================
 String          updateCaseURL  = "/CFHD/servlet/com.softplus.carrefour.hd.frontend.servlet.process.CFHDPC01"; 
 //String          updateCaseURL  = "closeStatus.jsp?status=close&caseno="+caseID; 
 String          thisURL                  = java.net.URLEncoder.encode((request.getRequestURI()+(request.getQueryString()!=null?"?"+request.getQueryString():"")));
 String          backURL                = java.net.URLDecoder.decode(((FileInfoUtil) session.getAttribute("fileInfoUtil")).getBackToMenu());
 String          forBackURL          =    request.getParameter("forBackURL")!=null?request.getParameter("forBackURL"): backURL;
 
     System.out.println(" * * * * * backURL"+backURL+" * * * ");
     
     String backClick						= "Javascript:document.location=frm.forBackURL.value;"; //"window.location='" + updateCaseURL + "'" ; 
    
    // create manager
    //-----------Part Contact Information  Case Information------------------------------------------
      ICaseHeadViewer  caseheadManage  = (CCaseHeadManage)CFHDSystem.getControlClass("CASE_HEAD");
      //CfhdCaseHead           caseheadEntity  =   caseheadManage.getCaseHeadDesc(caseID);
     CfhdCaseHead           caseheadEntity = (CfhdCaseHead)session.getAttribute("headEntity")==null?caseheadManage.getCaseHeadDesc(caseID):(CfhdCaseHead)session.getAttribute("headEntity");

 	System.out.println("caseheadEntity.getCaseId()+++++++++++++++"+ caseheadEntity.getCaseId());	
	System.out.println("caseheadEntity.getUserId()+++++++++++++++"+ caseheadEntity.getUserId());	
	System.out.println("caseheadEntity.isOpenStatus()+++++++++++++++"+       caseheadEntity.isOpenStatus());
	
	String reportedBy ="";
    String dwNumber ="";
	
    if(caseheadEntity!=null)
    {
		reportedBy	=caseheadEntity.getReportedBy()==null?"":caseheadEntity.getReportedBy();
	    
	    dwNumber	=caseheadEntity.getDwNumber()==null?"":caseheadEntity.getDwNumber();
    }

    //     String OpenCaseDate = showData.CheckNull(caseheadEntity.getOpenCaseDate(),"");
  //    String ClosedCaseDate = showData.CheckNull(caseheadEntity.getCloseCaseDate(),""); 

    //-----------Detail-----------------------------------------
      ICaseDetailViewer  casedetailManage  = ( CCaseDetailManage)CFHDSystem.getControlClass("CASE_DETAIL");
     CfhdCaseDetail           casedetailEntity  =   casedetailManage.getCaseHeadDetail(caseID);

      //-----------Attachment  Description----------------------------------------
     ICaseDocViewer  casedocManage  = (com.softplus.carrefour.hd.bltier.pc.CCaseDocManage)CFHDSystem.getControlClass("CASE_DOC");
     CfhdCaseDoc           casedocEntity  =  casedocManage.getCaseDocByPK(new CfhdCaseDocPK(caseID,new BigDecimal(0),new BigDecimal(0) ));     
 
//------getCaseDetailbyCaseHead----------------
          Vector           vectorCaseDetailbyCaseHead  =   casedetailManage.getCaseDetailbyCaseHead(caseID);
         //  Vector           vectorCaseDetailbyCaseHead  =   casedetailManage.getHistoryCaseDetail(caseID,userid);
                                                          int  vectorSize =   vectorCaseDetailbyCaseHead.size();

      	String 		url                 = "/CFHD/servlet/com.softplus.carrefour.hd.frontend.servlet.process.CFHDPC07_1?closeStatus=close&caseno="+caseID;    
          String 		urlRefresh  = "/CFHD/servlet/com.softplus.carrefour.hd.frontend.servlet.process.CFHDPC07_1?closeStatus=close&noRedirect=refresh&caseno="+caseID;          
      	String 		urlLogout    = "/CFHD/servlet/com.softplus.carrefour.hd.frontend.servlet.process.CFHDPC07_1?closeStatus=close"+"&noRedirect=logout&caseno="+caseID;       
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Udong : change reporter name to be owner case of sequence 0
		UserLevelManage	levelManage	=	(UserLevelManage) CFHDSystem.getControlClass("USER_LEVEL");
		CfhdCaseDetail    	dataDetail 		=	(CfhdCaseDetail) vectorCaseDetailbyCaseHead.elementAt(0);
		//UserLevel					levelEntity		=	(UserLevel) levelManage.getUserLevel(dataDetail.getUserId());
		//String		nameSeq0			=	levelEntity.getUserAccount().getUserName()==null?"":levelEntity.getUserAccount().getUserName();
		//String		surnameSeq0	=	levelEntity.getUserAccount().getUserSurname()==null?"":levelEntity.getUserAccount().getUserSurname();

  //System.out.println("=====^^^^^^^^^^^^^^^^1^^^^^^^^^^^^^^^");       
		UserAccount					levelEntity		=	(UserAccount) levelManage.getUserAccount(dataDetail.getUserId());
 //System.out.println("=====^^^^^^^^^^^^^^^^2^^^^^^^^^^^^^^^");       
		String		nameSeq0			=	levelEntity.getUserName()==null? "":levelEntity.getUserName();
// System.out.println("=====^^^^^^^^^^^^^^^^3^^^^^^^^^^^^^^^");       
		
		String		surnameSeq0	=	levelEntity.getUserSurname()==null? "":levelEntity.getUserSurname();
 //System.out.println("=====^^^^^^^^^^^^^^^^4^^^^^^^^^^^^^^^");       

// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    	String attFileNameNew ="";
    	//System.out.println("=====^^^^^^^^1111^^^^^^^^attFileNameNew^^^^^^^^^^^^^^^"+attFileNameNew);       
try{
     if((casedocEntity!=null) &&(casedocEntity.getAttFileName()!=null))
     {
			attFileNameNew = java.net.URLDecoder.decode(casedocEntity.getAttFileName());
			System.out.println("=====^^^^^^^^^^^^^^^^attFileNameNew^^^^^^^^^^^^^^^"+attFileNameNew);       
	}
}catch(java.lang.IllegalArgumentException e)
{attFileNameNew=casedocEntity.getAttFileName() ;
System.out.println("=====^^^^^^^^^error error error^^^^^^^^^"+attFileNameNew);     }
HashMap ulevelMap = UserLevel.uLevel;
%>
<%//@include file="../include/eproPopupJsp.jsp"%>
<%@ include file="../include/eproErrorAlert.jsp"%>
<BODY onunload="callCFRLWEBLN00_2();if(frm.checkUnload.value==''){callCFRLWEBLN00_2();goBackstatus();} parent.logout.onclick = parent.whenLogout ; "  >
     <div id="processingLayer" style="visibility:hidden; position:absolute; left:50px; top:150px;">
          <IMG alt="Waiting..." SRC="../images/background/Processing.gif" WIDTH="585" HEIGHT="136" BORDER="0">
     </div>
<%=fileInfoUtil.MasterHeadTable()%>
<DIV style="width:100%;height:90%;margin:5px"><!-- class="modalBg" -->
     <%//@include file="../include/softplusModalDialogToolbar.jsp"%>
	<CENTER>                                                
		<FORM name="frm" action="../servlet/com.softplus.carrefour.hd.frontend.servlet.process.CFHDPC06" method="get" target="chkUpload">
<input type="hidden" name="caseId"  value="">
<input type="hidden" name="detSeq"  value="">
<input type="hidden" name="docSeq"  value="">
<input type="hidden" name="action"  value="">
<input type="hidden" name="checkUnload" value="">
<input type="hidden" value="<%= forBackURL %>" name="forBackURL" >
		
<!-------------Case No.------Case Status-- Close Case-----Back---------------------------------->
<TABLE width="<%=tableWidth1%>"  border="0">
	<TR>
		<TD class="titleFont" colspan="2" align="left">Case No. : </TD>
		<TD  width="<%=inputColWidth1%>" align="right"><span class="disabledTxtField" style="white-space:nowrap;"><%=caseID%></span><!-- <INPUT type="text" readonly="readonly" class="disabledTxtField" value="<%-- =caseID --%>"> --></TD>
	</TR>
	<TR>
		<TD><!--INPUT type="button" value="Close Case" style="width: <%=buttonWidth%>"--> 
		        <!--INPUT type="button" value="Back" style="width: <%=buttonWidth%>"-->
               	<IMG alt="Back" src="../images/icon/toolbar/nBackToMenu.gif" onmouseover="this.src='../images/icon/toolbar/oBackToMenu.gif'" onmouseout="this.src='../images/icon/toolbar/nBackToMenu.gif'" style="cursor:hand" onclick="<%=backClick%>">
     <%
/*
                        IUserLevelViewer       ulViwer  = (UserLevelManage)CFHDSystem.getControlClass("USER_LEVEL");
                  		String  uLevel                 = "";
											try{ 
													uLevel   = ulViwer.getUserLevelByUserID(userid)==null? "":ulViwer.getUserLevelByUserID(userid);// udong updated cause admin have not user level
											}catch(NullPointerException ne){
													//throw new CFException("4002");	// udong updated cause admin have not user level
													//ne.printStackTrace();	// udong updated cause admin have not user level
											}
                         //System.out.println(" =====  !!!!!userid > "+userid);
                         //System.out.println(" === !!!!!!!!!U Level > "+uLevel);

 if(    (uLevel.equals("L1C"))   &&    ( caseheadEntity.getCaseStatus().equals("CLS") ||  caseheadEntity.getCaseStatus().equals("CCD") )     ){
 */
%>	            
 <!--IMG alt="Close Case" src="../images/icon/toolbar/nCloseCase.gif" onmouseover="this.src='../images/icon/toolbar/oCloseCase.gif'" onmouseout="this.src='../images/icon/toolbar/nCloseCase.gif'" style="cursor:hand" onclick="CloseCase()"-->		        
<%
//}
%>		        
	 </TD>
		<TD class="titleFont" width="<%=labelColWidth%>" align="left">Case Status : </TD>
		<TD width="<%=inputColWidth1%>" align="right"><INPUT type="text" readonly="readonly" class="disabledTxtField" value="<%= caseheadEntity==null || caseheadEntity.getCaseStatus()==null?"":CfhdCaseHead.getStatusDesc(caseheadEntity.getCaseStatus())%>"> </TD>
	</TR>
</TABLE>
<!------------------------------------------------------------>

			
			<TABLE align="center" width="100%">
			<!-------------------------------------------------------------------11111111111111-Contact Information---------------------------------------------------------------------->

				<TR>
					<TD colspan="3">
						
						
<FIELDSET style="width:<%=tableWidth%> ">
<LEGEND class="titleFont">Contact Information</LEGEND>
<TABLE width="<%=tableWidth%>">
	<TR>
		<TD class="titleFont" width="<%=labelColWidth%>"><FONT color="red"></FONT> Requester Name : </TD>
		<TD colspan="3" width="<%=inputColWidth%>">
		<INPUT type="text" name="reqName"   value="<%=caseheadEntity==null || caseheadEntity.getReqName()==null?"":caseheadEntity.getReqName()%>" readonly="readonly" class="disabledTxtField" style="width: <%=longBoxWidth%>" >
		</TD>
	</TR>
	<TR>
		<TD class="titleFont" width="<%=labelColWidth%>">Tel No. : </TD>
		<TD width="<%=inputColWidth%>">
		<INPUT type="text" name="telephone" value="<%=showData.CheckNull(caseheadEntity==null || caseheadEntity.getReqTel()==null?"":caseheadEntity.getReqTel())%>"  readonly="readonly" class="disabledTxtField"></TD>
		<TD class="titleFont" width="<%=labelColWidth%>">Fax No. : </TD>
		<TD width="<%=inputColWidth%>"><INPUT type="text" name="fax"  value="<%=showData.CheckNull(caseheadEntity==null || caseheadEntity.getReqFax()==null?"":caseheadEntity.getReqFax())%>" readonly="readonly" class="disabledTxtField"></TD>
	</TR>
</TABLE>
</FIELDSET>
						
						
					</TD>
				</TR>
				
				<!----------------------------------------------------------------------222222222----Case Information------------------------------------------------------------------------------------>
				<TR>
					<TD colspan="3">
						<FIELDSET class="titleFont">
						<LEGEND class="titleFont">Case Information</LEGEND>
<%if(!reportedBy.equals("")){ %>
<div class="titleFont">
 	Reported By :&nbsp;&nbsp;<INPUT readonly="readonly" class="disabledTxtField" type="text" style="width: 200" name="rptBy" maxlength="12" value="<%=ulevelMap.get(reportedBy).toString() %>">
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	DW Number :&nbsp;&nbsp;<INPUT readonly="readonly" class="disabledTxtField" type="text" style="width: 155" name="DWNumber" maxlength="12" value="<%=dwNumber %>">
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</div>
<%} %>											
						<TABLE align="center" width="100%" border="0">
						   <!--INPUT type="hidden" name="roleID"-->
	<TR> 
		<TD class="titleFont" width="<%=labelColWidth%>">Open Case Date : </TD>
		<TD width="<%=inputColWidth%>"><INPUT type="text" name="OpenCaseDate" value="<%=caseheadEntity==null || caseheadEntity.getOpenCaseDate()==null?"":showData.CheckNull(caseheadEntity.getOpenCaseDate(),"")%>"  readonly="readonly" class="disabledTxtField"></TD>
		<TD class="titleFont" width="<%=labelColWidth%>">Closed Case Date : </TD>
		<TD width="<%=inputColWidth%>"><INPUT type="text" value="<%=caseheadEntity==null || caseheadEntity.getCloseCaseDate()==null?"":showData.CheckNull(caseheadEntity.getCloseCaseDate(),"")%>"   readonly="readonly" class="disabledTxtField"></TD>
	</TR>                   
	<TR>
		<TD class="titleFont" width="<%=labelColWidth%>">Reporter Name : </TD>
		<TD colspan="3" width="<%=inputColWidth%>">
		<INPUT type="text" value="<%=nameSeq0%> <%=surnameSeq0%>" style="width: <%=longBoxWidth%>" readonly="readonly" class="disabledTxtField">
		</TD>
	</TR>
	<TR>
		<TD class="titleFont" width="<%=labelColWidth%>">Country : </TD>
		<TD width="<%=inputColWidth%>">
		
		<INPUT type="text" value="<%=caseheadEntity==null || caseheadEntity.getCountry()==null?"":showData.CheckNull(caseheadEntity.getCountry().getCountryName())%>" readonly="readonly" class="disabledTxtField" >
		</TD>
		<TD class="titleFont" width="<%=labelColWidth%>">Site : </TD>
		<TD width="<%=inputColWidth%>">
		<INPUT type="text"  value="<%=caseheadEntity==null || caseheadEntity.getStoreId()==null?"":caseheadEntity.getMdStore()==null?"":caseheadEntity.getMdStore().getStoreName()%>" readonly="readonly" class="disabledTxtField">
		</TD>
	</TR>
	<TR>
		<TD class="titleFont" width="<%=labelColWidth%>">System : </TD>
		<TD width="<%=inputColWidth%>">
		<INPUT type="text"  value="<%= caseheadEntity==null || caseheadEntity.getCfhdSystem()==null ? "" : caseheadEntity.getCfhdSystem() %>" readonly="readonly" class="disabledTxtField">
		</TD>
		<TD class="titleFont" width="<%=labelColWidth%>">Module : </TD>
		<TD width="<%=inputColWidth%>">
		<INPUT type="text"  value="<%=caseheadEntity==null || caseheadEntity.getCfhdModule()==null ?"" :caseheadEntity.getCfhdModule()%>" readonly="readonly" class="disabledTxtField"></TD>
	</TR>
	<TR>
		<TD class="titleFont" width="<%=labelColWidth%>">Aldata Internal No. : </TD>
		<TD colspan="3" width="<%=inputColWidth%>">
		<INPUT type="text" value="<%=caseheadEntity==null || caseheadEntity.getAlDataNo()==null?"":caseheadEntity.getAlDataNo()%>" style="width: <%=longBoxWidth%>" readonly="readonly" class="disabledTxtField"></TD>
	</TR>
	<TR>
		<TD class="titleFont" width="<%=labelColWidth%>">GOLD Version : </TD>
		<TD width="<%=inputColWidth%>">
		<INPUT type="text" value="<%=caseheadEntity==null || caseheadEntity.getGoldVersion()==null ?"":caseheadEntity.getGoldVersion()%>" readonly="readonly" class="disabledTxtField"></TD>
		<TD class="titleFont" width="<%=labelColWidth%>">Environment : </TD>
		<TD width="<%=inputColWidth%>">
		<INPUT type="text" value="<%=caseheadEntity==null || caseheadEntity.getCfhdEnvironment()==null?"":caseheadEntity.getCfhdEnvironment()%>"  readonly="readonly" class="disabledTxtField">
		</TD>
	</TR>
	<TR>
		<TD class="titleFont" width="<%=labelColWidth%>">Screen Name : </TD>
		<TD colspan="3" width="<%=inputColWidth%>">
		<INPUT type="text" value="<%=caseheadEntity==null || caseheadEntity.getScreenName()==null?"":caseheadEntity.getScreenName()%>" style="width: <%=longBoxWidth%>" readonly="readonly" class="disabledTxtField"></TD>
	</TR>
						</TABLE>
						
						</FIELDSET>
					</TD>
				</TR>
				
				<!--------------------------------------------------------------------------333333333333------Case Context----------------------------------------------------------------------------------->
				<TR>
					<TD colspan="3">
						<FIELDSET class="titleFont">
						<LEGEND class="titleFont">Case Context</LEGEND>
					
						<TABLE align="center" width="100%" border="0">
	<TR>
		<TD class="titleFont" width="<%=labelColWidth%>"><FONT color="red"></FONT> Current Case Type : </TD>
		<TD width="<%=inputColWidth%>">
		<INPUT type="text" value="<%=caseheadEntity ==null || caseheadEntity.getCaseType()==null?"":CfhdCaseHead.getCaseTypeDesc(caseheadEntity.getCaseType())%>" readonly="readonly" class="disabledTxtField"></TD>
		<TD class="titleFont" width="<%=labelColWidth%>"><FONT color="red"></FONT> Current Severity : </TD>
		<TD width="<%=inputColWidth%>">
		<INPUT type="text" value="<%=caseheadEntity ==null || caseheadEntity.getSeverity()==null?"":CfhdCaseHead.getServerityDesc(caseheadEntity.getSeverity().toString())%>" readonly="readonly" class="disabledTxtField"></TD>
	</TR>
	<TR>
		<TD class="titleFont" width="<%=labelColWidth%>"><FONT color="red"></FONT> Original Case Type : </TD>
		<TD width="<%=inputColWidth%>"><INPUT type="text" value="<%=caseheadEntity ==null || caseheadEntity.getOriginCaseType()==null?"":CfhdCaseHead.getCaseTypeDesc(caseheadEntity.getOriginCaseType())%>" readonly="readonly" class="disabledTxtField"></TD>
		<TD class="titleFont" width="<%=labelColWidth%>"><FONT color="red"></FONT> Original Severity : </TD>
		<TD width="<%=inputColWidth%>"><INPUT type="text" value="<%=caseheadEntity ==null || caseheadEntity.getOriginSeverity()==null?"":CfhdCaseHead.getServerityDesc(""+caseheadEntity.getOriginSeverity())%>" readonly="readonly" class="disabledTxtField"></TD>
	</TR>
	<TR>
		<TD class="titleFont" width="<%=labelColWidth%>"><FONT color="red"></FONT> Subject : </TD>
		<TD colspan="3" width="<%=inputColWidth%>">
		<INPUT type="text"   value="<%=caseheadEntity==null?"":caseheadEntity.getSubject()%>" style="width: <%=longBoxWidth%>" readonly="readonly" class="disabledTxtField"></TD>
	</TR>
<%
if(casedetailEntity!=null){
%>	
	<TR>
		<TD class="titleFont" width="<%=labelColWidth%>"><FONT color="red"></FONT> Detail : </TD>
		<TD colspan="3"><TEXTAREA  rows="5"  style="width: <%=longBoxWidth%>" readonly="readonly" class="disabledTxtField"><%=showData.CheckNull(casedetailEntity.getDetDesc())%></TEXTAREA></TD>
	</TR>
<%
    }
 if(casedocEntity!=null){   
%>	
	<TR >
		<TD class="titleFont" width="<%=labelColWidth%>">Attachment : </TD>
		<TD colspan="3" >
     		<INPUT type="text"  value="<%=showData.CheckNull(attFileNameNew)%>" style="width: <%=longBoxWidth%>" readonly="readonly" class="disabledTxtField">	
            <%            if(!(showData.CheckNull(casedocEntity.getAttFileName()).equals(""))){       %>
	     <img src="../images/icon/toolbar/nSaveAs.gif" width="21" height="21" align="bottom" onClick="download(0)" alt="Download" >
	        <%}%>	
		</TD>
		
	
	</TR>
	<TR>
		<TD class="titleFont" width="<%=labelColWidth%>">Description : </TD>
		<TD colspan="3" width="<%=inputColWidth%>"><TEXTAREA rows="5" style="width: <%=longBoxWidth%>" readonly="readonly" class="disabledTxtField"><%=showData.CheckNull(casedocEntity.getAttDesc())%></TEXTAREA></TD>
	</TR>
<%
 }
%>	
	
						</TABLE>
						
						</FIELDSET>
					</TD>
				</TR>
				
				<!----------------------------------------------------->
				
				
			</TABLE>
<%
//===================================================================================
 if(vectorSize>1){
 %>			

	<!-- Scroll Table -->
<span class="caseCategory">&nbsp;&nbsp;History&nbsp;</span> 
<a href="Javascript:" class="caseCategory" onclick="expandAll('historyTable')" >expand all</a> 
<a href="Javascript:" class="caseCategory" onclick="collapseAll('historyTable')" >collapse all</a>
<br>

<div id="tableContainer">
<table id="historyTable" width="99%"  border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFCC" class="scrollTable">
<thead >
  <tr align="center">
    <th nowrap="nowrap" align="left" >Updated Date (from/to) </th>
    <th nowrap="nowrap" >Owner</th>
    <th nowrap="nowrap" >Country</th>
    <th nowrap="nowrap" >Status</th>
    <th nowrap="nowrap" >Action</th>
    <th nowrap="nowrap" >&nbsp;<!-- Action --></th>
  </tr>
  </thead>
    <tbody class="scrollContent">
  <% 
          String historyBarClassname    = "trUnselect";
          String historyBarOnClickScript = "toggleContent(this)";
          String historyDescClassname = "trHidden";
          boolean checkValid = true;

///--------------for----------------------------------      
  
          for(int i=1; i<vectorSize;i++){ 

             CfhdCaseDetail    pdataCaseDetail =  (CfhdCaseDetail) vectorCaseDetailbyCaseHead.elementAt(i-1);
           
               
             CfhdCaseDetail    cdataCaseDetail =  (CfhdCaseDetail) vectorCaseDetailbyCaseHead.elementAt(i);
  
        if(i==(vectorSize-1)){ //If history is not complete HistoryDesc will not hiddin its content.
        String checkValidnull = cdataCaseDetail==null || cdataCaseDetail.getCaseDetStatus()==null?CfhdCaseHead.STATUS_VALIDATED:cdataCaseDetail.getCaseDetStatus();
 		System.out.println(i+"++++++++++checkValidnull========"+cdataCaseDetail.getCaseDetStatus()); 
 		if(checkValidnull.equals(CfhdCaseHead.STATUS_VALIDATED))
 		{
		          historyBarOnClickScript = "modifyContent('keyInformation')";
		          historyBarClassname    = "trUndefined";
		          historyDescClassname = "trUndefined";
		 }else{
		 				checkValid =false;
		 			}
        } 
	
                 //------------------Attachment ??? Description  ??? History-----------    
      
                       casedocEntity  =   casedocManage.getCaseDocByPK(new CfhdCaseDocPK(caseID,new BigDecimal(i),new BigDecimal(0) )); 
                        
try{
     if((casedocEntity!=null) &&(casedocEntity.getAttFileName()!=null))
     {
			attFileNameNew = java.net.URLDecoder.decode(casedocEntity.getAttFileName());
			System.out.println("=====^^^^^^^^^^^^^^^^attFileNameNew^^^^^^^^^^^^^^^"+attFileNameNew);       
	}
}catch(java.lang.IllegalArgumentException e)
{attFileNameNew=casedocEntity.getAttFileName() ;
System.out.println("=====^^^^^^^^^error error error^^^^^^^^^"+attFileNameNew);     }
              
                String temp="&nbsp"; 
                String openTime=cdataCaseDetail.getOpenedTime()==null?temp: showData.CheckNull(sdFormat.format(cdataCaseDetail.getOpenedTime() ) );      
                 String submitTime=cdataCaseDetail.getSubmitTime()==null?temp: showData.CheckNull(sdFormat.format(cdataCaseDetail.getSubmitTime() ) ) ;     

                                  
                      //cdataCaseDetail.getUserId()==null? temp:showData.CheckNull(cdataCaseDetail.getUserAccount().getUserName())
                   //   cdataCaseDetail.getCountryId()==null? temp:showData.CheckNull(cdataCaseDetail.getCountry().getCountryName())
                 //     cdataCaseDetail.getCaseDetStatus()==null? temp:showData.CheckNull(cdataCaseDetail.getCaseDetStatus())
      %>
  <!-- History Bar -->
  <tr name="HistoryBar" id="HistoryBar" class="<%= historyBarClassname %>" onMouseOver="rowOver(this)" onMouseOut="rowOut(this)" onClick="<%= historyBarOnClickScript %>">
    <td align="left" nowrap><%= openTime%> - <%= submitTime%> </td>
    <%                
    						//System.out.println("*******************//i=========="+i); 
    					   	//System.out.println("************getUserAccount()=========="+cdataCaseDetail.getUserAccount()); 
    					  	//System.out.println("************getUserName()=========="+cdataCaseDetail.getUserAccount().getUserName()); 
    					   	//System.out.println("************getUserSurname()=========="+cdataCaseDetail.getUserAccount().getUserSurname()); 
    %>

    
    <td align="center" nowrap>
    <%=cdataCaseDetail ==null || cdataCaseDetail.getUserAccount()==null || cdataCaseDetail.getUserId()==null?temp:cdataCaseDetail.getUserAccount().getUserName()==null?temp:cdataCaseDetail.getUserAccount().getUserName()%> 
     &nbsp;<%=cdataCaseDetail ==null || cdataCaseDetail.getUserAccount()==null || cdataCaseDetail.getUserId()==null?temp:cdataCaseDetail.getUserAccount().getUserSurname()==null?temp:cdataCaseDetail.getUserAccount().getUserSurname()%>
     </td>
    <td align="center" nowrap>
    <%=cdataCaseDetail ==null || cdataCaseDetail.getCountryId()==null? temp:cdataCaseDetail.getCountry()==null?temp:cdataCaseDetail.getCountry().getCountryName()%></td>
    <td align="center" nowrap>
    <%=cdataCaseDetail ==null || cdataCaseDetail.getCaseDetStatus()==null? temp:CfhdCaseHead.getStatusDesc(cdataCaseDetail.getCaseDetStatus())%></td>
   
    <!--noom  21 12 2004 ??? ??? Undefined ???-->
    <!--td align="center" nowrap><%//  if(i<(vectorSize-1)){ %> Some Action<%//}else{%>Undefined<%//}%></td>
       <td align="center" nowrap>
        <%// if(i<(vectorSize-1)){%>
          <img src="../images/icon/toolbar/nSaveAs.gif" width="21" height="21" align="bottom" onClick="downloadThis('keyInformation')">
          <%//}else{ %>
          <img src="../images/icon/toolbar/nEdit.gif" width="21" height="21" align="bottom">
          <% // } 
         
       //    cdataCaseDetail.getCaseAction()==null? temp:showData.CheckNull(CfhdCaseDetail.getDetailDesc(cdataCaseDetail.getCaseAction()))
          %>
          
      </td-->  
     <td align="center" nowrap> <%=cdataCaseDetail ==null || cdataCaseDetail.getCaseAction()==null? "Undefined":showData.CheckNull(CfhdCaseDetail.getDetailDesc(cdataCaseDetail.getCaseAction()))%></td>
     
       <td align="center" nowrap>
       
       <%
       if(casedocEntity!=null){
              //System.out.println("///////****=======casedocEntity.getAttFileName()"+casedocEntity.getAttFileName()); 

            if(!(showData.CheckNull(casedocEntity.getAttFileName()).equals(""))){  

       %>
          <img alt="Save" src="../images/icon/toolbar/nSaveAs.gif" width="21" height="21" align="bottom" onClick="download(<%=i%>)" >
           <%}else out.print("<DIV style='height: 20px'>&nbsp;</DIV>");
             }else out.print("<DIV style='height: 20px'>&nbsp;</DIV>");
           %>
      </td>
 
    <!-- END   noom  21 12 2004 ??? ??? Undefined ???-->
   </tr>
  <%
  if((i<(vectorSize)-1)||(!checkValid)){ //If it is 'undefined status it'll not show %>
  <tr id="HistoryDesc" class="<%= historyDescClassname %>" style="height:50px;">
    <!-- History Description  -->
    <td colspan="6"  id="historyDescTable">
    <!-- start case detail, maybe use iframe for deatail of the case.  -->
        <table width="99%"  border="0" cellspacing="2" cellpadding="2">
        <!--************???? table*************-->
				<TR>
					<TD colspan="3">
						<FIELDSET class="titleFont">
						<LEGEND class="titleFont">History Detail</LEGEND>
					
						<TABLE align="center" width="100%" border="0">
	<TR>
		<TD class="titleFont" width="<%=labelColWidth%>"><FONT color="red"></FONT>  Case Type : </TD>
		<TD width="<%=inputColWidth%>">
		<INPUT type="text" value="<%=pdataCaseDetail ==null || pdataCaseDetail.getCaseDetType() ==null ?"":showData.CheckNull(CfhdCaseHead.getCaseTypeDesc(pdataCaseDetail.getCaseDetType()))%>"  readonly="readonly" class="disabledTxtField">
		</TD>
		<TD class="titleFont" width="<%=labelColWidth%>"><FONT color="red"></FONT>  Severity : </TD>
		<TD width="173">
		<INPUT type="text" value="<%=pdataCaseDetail ==null || pdataCaseDetail.getCaseDetServerity() ==null ?"":showData.CheckNull(CfhdCaseHead.getServerityDesc(""+pdataCaseDetail.getCaseDetServerity()))%>"  readonly="readonly" class="disabledTxtField"></TD>
	</TR>
	<TR>
		<TD class="titleFont" width="<%=labelColWidth%>"><FONT color="red"></FONT> Requalify Type To : </TD>
		<TD width="<%=inputColWidth%>">
		<INPUT type="text"   value="<%=cdataCaseDetail ==null || cdataCaseDetail.getCaseDetType() ==null ?"":showData.CheckNull(CfhdCaseHead.getCaseTypeDesc(cdataCaseDetail.getCaseDetType()))%>" readonly="readonly" class="disabledTxtField"></TD>
		<TD class="titleFont" width="<%=labelColWidth%>"><FONT color="red"></FONT> Change Severity To : </TD>
		<TD width="173">
		<INPUT type="text"  value="<%=cdataCaseDetail ==null || cdataCaseDetail.getCaseDetServerity() ==null ?"":showData.CheckNull(CfhdCaseHead.getServerityDesc(""+cdataCaseDetail.getCaseDetServerity()))%>" readonly="readonly" class="disabledTxtField"></TD>
	</TR>
	<TR>
		<TD class="titleFont" width="<%=labelColWidth%>"><FONT color="red"></FONT> Owner Name : </TD>
		<TD colspan="3" width="<%=inputColWidth%>">
		<INPUT type="text" value="<%= cdataCaseDetail ==null || cdataCaseDetail.getUserAccount() ==null || cdataCaseDetail.getUserAccount().getUserName()==null ?"&nbsp;":showData.CheckNull(cdataCaseDetail.getUserAccount().getUserName())%> <%= cdataCaseDetail ==null || cdataCaseDetail.getUserAccount() ==null || cdataCaseDetail.getUserAccount().getUserSurname() ==null ?"":showData.CheckNull(cdataCaseDetail.getUserAccount().getUserSurname())%>"
		style="width: <%=longBoxWidth%>" readonly="readonly" class="disabledTxtField"></TD>
	</TR>
<%
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Udong : change transfer to someone be name and surname
	String		nameTransfer		=	"";
	String		surnameTransfer	=	"";
	if(cdataCaseDetail.getTransferTo()!=null){
		UserAccount				useraccountEntity		=	(UserAccount) levelManage.getUserAccount(cdataCaseDetail.getTransferTo());
		  if(useraccountEntity!=null){
		 			nameTransfer		=	useraccountEntity.getUserName()==null? "":useraccountEntity.getUserName();
					surnameTransfer	=	useraccountEntity.getUserSurname()==null?"":useraccountEntity.getUserSurname();
					}
		//UserLevel				userlevelEntity		=	(UserLevel) levelManage.getUserLevel(cdataCaseDetail.getTransferTo());
		//nameTransfer		=	userlevelEntity.getUserAccount().getUserName()==null? "":userlevelEntity.getUserAccount().getUserName();
		//surnameTransfer	=	userlevelEntity.getUserAccount().getUserSurname()==null?"":userlevelEntity.getUserAccount().getUserSurname();
	}
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%>		
	<TR>
		<TD class="titleFont" width="<%=labelColWidth%>"><FONT color="red"></FONT> Transfer To : </TD>
		<TD colspan="3" width="<%=inputColWidth%>">
		<INPUT type="text"  value="<%=nameTransfer%> <%=surnameTransfer%>" style="width: <%=longBoxWidth%>" readonly="readonly" class="disabledTxtField"></TD>
	</TR>
	<TR>
		<TD class="titleFont" width="<%=labelColWidth%>"><FONT color="red"></FONT> To User Level : </TD>
		<TD colspan="3" width="<%=inputColWidth%>">
		<INPUT type="text" value="<%=cdataCaseDetail ==null || cdataCaseDetail.getTransferToLv() ==null ?"":showData.CheckNull(UserLevel.getLevelName(cdataCaseDetail.getTransferToLv()))%>" style="width: <%=longBoxWidth%>" readonly="readonly" class="disabledTxtField"></TD>
	</TR>
	<TR>
		<TD class="titleFont" width="<%=labelColWidth%>"><FONT color="red"></FONT> Type of Error : </TD>
		<TD colspan="3" width="<%=inputColWidth%>">
		<INPUT type="text" value="<%=cdataCaseDetail ==null || cdataCaseDetail.getCfhdErrType() ==null ?"":showData.CheckNull(cdataCaseDetail.getCfhdErrType())%>" style="width: <%=longBoxWidth%>" readonly="readonly" class="disabledTxtField"></TD>
	</TR>

<%
if(cdataCaseDetail!=null){
%>	
		
	<TR>
		<TD class="titleFont" width="<%=labelColWidth%>"><FONT color="red"></FONT> Detail : </TD>
		<TD colspan="3"><TEXTAREA rows="5" style="width: <%=longBoxWidth%>" readonly="readonly" class="disabledTxtField"><%=showData.CheckNull(cdataCaseDetail.getDetDesc())%></TEXTAREA></TD>
	</TR>  

<%

    }
 if(casedocEntity!=null){   
%>	
	
	<TR >
		<TD class="titleFont" width="<%=labelColWidth%>">Attachment : </TD>
		<TD colspan="3" >
		
    		<INPUT type="text"  value="<%=showData.CheckNull(attFileNameNew)%>" style="width: <%=longBoxWidth%>" readonly="readonly" class="disabledTxtField">	
            <%if(!(showData.CheckNull(casedocEntity.getAttFileName()).equals(""))){       %>
	     <img src="../images/icon/toolbar/nSaveAs.gif" width="21" height="21" align="bottom" onClick="download(<%=i%>)" alt="Download" >
	        <%}%>	
		</TD>
		
	
	</TR>
	

	<TR>
		<TD class="titleFont" width="<%=labelColWidth%>">Description : </TD>
		<TD colspan="3" width="<%=inputColWidth%>"><TEXTAREA rows="5" style="width: <%=longBoxWidth%>" readonly="readonly" class="disabledTxtField"><%=showData.CheckNull(casedocEntity.getAttDesc())%></TEXTAREA></TD>
	</TR>
	<%}%>
						</TABLE>
						
						</FIELDSET>
					</TD>
				</TR>
	       <!--************?????? table*************-->
				
            </table>
            <%//  }  %>
            <!-- end case detail -->
    </td>
  </tr>

            <% }  %>
            <!-- end case detail -->
    </td>
  </tr>		
  
    <%
    // End of History
         } 
  %>
<!-- end Scroll Table --***********************************************************-->		
<%
     }
     out.println("<!-- history bar closed -->");
%>
		</FORM>
	</CENTER>
</DIV>
<%= fileInfoUtil.MasterFootTable() %>

<iframe id="counter1" frameborder="0" scrolling="auto" height="0" width="0" src="autoescalate.jsp?caseID=<%= caseID%>"></iframe>
<iframe id="counter2" frameborder="0" scrolling="auto" height="0" width="0" src="autoescalate02.jsp?caseID=<%= caseID%>"></iframe>
<IFRAME name="chkUpload" frameborder="0" height="0">aa</IFRAME>
<SCRIPT type="text/javascript">
onload=callCFRLWEBLN00;
function callCFRLWEBLN00() {
parent.checkFlag();
}
//onunload=callCFRLWEBLN00_2;
function callCFRLWEBLN00_2() {
parent.setfree();
}
function confirmIELeave() {
    event.returnValue = "Are you sure you want to leave Update Case page?";
}
function confirmNSLeave(iWindow) {
     if (!document.layers) return;
     if (!iWindow.closed){
     if (!confirm('Are you sure you want to leave this page?'))
            window.location.href = 'javascript:void(0)';
      }
    else window.open(location.href,'newwin');
}
       
          function download(detSeq)
          { //
          //alert(detSeq);
         // alert(document.all.frm);
               document.all.frm.caseId.value='<%=caseID%>';
               document.all.frm.detSeq.value=detSeq;
               document.all.frm.docSeq.value="0"; 
               document.all.frm.action.value="DowLoad";
               //alert(frm.action);
               callCFRLWEBLN00_2();
               frm.submit();
          } 
          
          function CloseCase()
          { 
               var okSaveButton = "<%=com.epro.standard.frontend.util.StringUtil.encode2Thai(com.epro.standard.frontend.datasetup.MessageManager.getString("okFormSubmitMessage"))%>";
               var cancelSaveButton = "<%=com.epro.standard.frontend.util.StringUtil.encode2Thai(com.epro.standard.frontend.datasetup.MessageManager.getString("cancelFormSubmitMessage"))%>";
          
          if(showOConfirmDialog("Close Case", "Do you want to Close Case ?", okSaveButton, cancelSaveButton) == 1)
          {						
            document.all.frm.caseId.value='<%=caseID%>';
               document.all.frm.action.value="CloseCase";
               frm.submit();
          }
          
          }

            /* open the modal dialog for edit page */
            function modifyContent(keyInformation){
            //alert(event.srcElement.tagName);
            if(event.srcElement.tagName!='IMG')
            {
                   var urlString = "iframeUP07.jsp?param1="+keyInformation+"&caseID="+'<%=caseID%>';
            //    var dialogW = window.showModalDialog(urlString,"dialogWidth:<%//= dialogWidth %>px; dialogHeight:<%//= dialogHeight%>px");
            //    alert(urlString);
            try{
                   var closeMe = showModalDialog(urlString, window.document, "status:no;resizeable:no;center:yes;dialogWidth=<%= dialogWidth %>px;dialogHeight=<%= dialogHeight%>px;scrollbar=no") ;
               }catch(error){}
               }
            }
  
 function goBackstatus()
 {
 	//if(showOConfirmDialog("Back to main menu", "Back to main menu ?", "OK", "Cancel") == 1)
 	//{
 			window.location='<%=url%>';
 	//}
 }
 
/*  function goLogout()
 {
 	window.location='<%//=urlLogout%>';
 }
*/ 
// parent.onunload = parent.location.href('<%//=urlRefresh%>') ;
/* alert(parent.location.href) ;
// alert(parent.onunload) ;
// alert(parent.body.onunload) ;
 function refreshParent()
 {
 	alert() ;
	parent.location.href = '<%//=urlRefresh%>';
 }*/
 parent.logout.onclick = unloadPage ;
 
 function unloadPage()
 { callCFRLWEBLN00_2();
 	if (confirm(parent.showUserName.innerHTML +' logout from system?')) {
	 	parent.logout.onclick = parent.whenLogout ;
 		parent.location='<%=urlLogout%>';
// 		parent.logout.click() ;
	}
 }

</SCRIPT>
</BODY>
</HTML>
 <%System.out.println("####### @@@@@@@@@END@@@@@@@######");%>
